export default {
    methods: {
        //获取指定字典
        getDict(columns,name,refs = 'icrud'){
            if(!columns){
                return this.$refs[refs].getDict();
            }
            var rearr = [];
            var dict = {
                value:"value",
                label:"label",
                color:"color",
                children:"children",
                isTree:false
            };
            if(!Array.isArray(columns)){
                dict =Object.assign({}, columns, dict);
                return this.$refs[refs].getDict(dict);
            }
            columns.forEach((column) => {
                if (column.dict && column.dict["name"] === name) {
                    dict =Object.assign({}, column.dict, dict);
                    rearr = this.$refs[refs].getDict(dict);
                }
            });
            return rearr;
        },
        //删除指定字典
        delDict(columns,name,refs = 'icrud'){
            var dict = {
                value:"value",
                label:"label",
                color:"color",
                children:"children",
                isTree:false
            };
            if(!Array.isArray(columns)){
                dict =Object.assign({}, columns, dict);
                this.$refs[refs].delDict(dict);
                return false;
            }
            columns.forEach((column) => {
                if (column.dict && column.dict["name"] === name) {
                    dict =Object.assign({}, column.dict, dict);
                    this.$refs[refs].delDict(JSON.stringify(dict));
                }
            });
        }
    }
};
